<template>
	<view class="container">
		<view class="head">
			<view class="hello">Hello!</view>
			<view class="xian"></view>
			<text class="deng">登录</text>
			<view class="number ">
				<image src="../../static/images/my1.png" mode=""></image>
				<input type="text" value="" placeholder="请输入您的账号" v-model="name" />
			</view>
			<view class="number ">
				<image src="../../static/images/suo.png" mode=""></image>
				<input type="password" :type="seen ? type_text : type_password" value="" placeholder="请输入登录密码" v-model="password" />
				<view v-show='seen' @click="changeSeen" class="eyes">
					 <img src="../../static/image/open.png" />
				</view>
				<view v-show='!seen' @click="changeSeen" class="eyes">
					<img src="../../static/image/close.png" />
				 </view>
			</view>
			<button type="default" @click="login">登录</button>
		</view>
		<image src="../../static/images/dian.png" mode="" class="img"></image>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				name:'',
				password:'',
				seen: false,
				type_text: "text",
				type_password: "password",
			}
		},
		methods:{
			changeSeen(){
				this.seen = !this.seen;
			},
			login(){
				uni.request({
				     url: this.$url + 'login',
					 // header:{
					 //  'Authorization': 'Bearer ' + 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjE2NTA1M2NmLTU0NWEtNDEwMC1hOTFjLTA1NWMzYzE3MTRkMiJ9.FdhinYbnRtvZpzzSdtWj7w7W-FbBYt3M_KSWL4id9IdLEdPZikhvaWknfje3ZUBeydc5Ky7_2WNXdzfkawmHyw'
					 // },
				     method: 'POST',
					 data:{
						 isCodeVerify: false,
						 username:this.name,
						 password:this.password,						  
					 },
				     success: (res) => {
				        console.log(res);
						if(res.data.code==200){
							console.log(res.data.data,111)
							uni.setStorageSync("token", res.data.data);
							uni.setStorageSync('user', this.name);
							uni.setStorageSync('password',this.password);
							uni.reLaunch({
								url:'../index/index'
							})
						}
				     },
				     complete: () => {
				      
				     },
				     fail: (e) => {
				      console.log(e);
				     }
				    });
			},
		}
	}
</script>

<style lang="scss">
page{
	height: 100wh;
	.eyes image{
		width: 20rpx;
		height: 20rpx;
		position: absolute;
		right: 60rpx;
	}
	.container{
		// position: relative;
		.head{
			background: url(../../static/images/bg.png) no-repeat right top;
			background-size: 100%;
			width: 670rpx;
			height: 410rpx;
			margin-left:80rpx;
			.hello{
				padding-top: 182rpx;
				font-size: 62rpx;
				font-weight: bolder;
				color: #3472FD;
			}
			.xian{
				width: 65rpx;
				height: 8rpx;
				background: #3472FD;
	            margin: 20rpx 0;
			}
			.deng{
				font-size: 44rpx;
				font-weight: bold;
				color: #3A3A3A;
				// padding-bottom: 50rpx;
			}
			.number{
				display: flex;
				align-items: center;
				margin: 35rpx 80rpx 35rpx 0rpx;
				border-bottom: 1px solid #E4E4E4;
				padding-bottom: 35rpx;
				image{
					width: 28rpx;
					height: 30rpx;
					margin-right: 30rpx;
				}
			}
			button{
				margin-right:80rpx;
				width: 500rpx;
				height: 98rpx;
				background: #3472FD;
				opacity: 0.9;
				border-radius: 49rpx;
	            color: #fff;
				margin: 80rpx auto;
			}
		}
		.img{
			width: 750rpx;
			height: 380rpx;
			position: fixed;
			left: 0;
			bottom: 0;			
			display: block;
		}
	}
}	
</style>
